<!doctype html>
<html lang="en">
<head>
    <title>API for class template (phpAPI: PHP Documentation Creator version 6.0)</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="generator" content="phpAPI 6.0 (https://github.com/Greenray/phpAPI/)">
    <link rel="stylesheet" type="text/css" href="../style.css">
    <link rel="start" href="../index.html">
</head>
    <body id="template" onload="parent.document.title=document.title;">
    <div class="header">
    <span style="float:right">phpAPI v6.0</span>
            <ul>
                    <li><a href="../overview-summary.html">Overview</a></li>
                    <li><a href="../template/package-summary.html">Namespace</a></li>
                    <li class="active">Class</li>
                    <li><a href="../template/package-tree.html">template\Tree</a></li>
                    <li><a href="../deprecated.html">Deprecated</a></li>
                    <li><a href="../todo.html">Todo</a></li>
                    <li><a href="../index-all.html">Index</a></li>
                </ul>
    </div>
<hr />
<div class="small_links">Frames: <a href="../index.html" target="_top"> On</a> | <a href="" target="_top"> Off</a></div>
<hr />
    <div class="small_links">
        <a href="#details_fields">Fields</a> | <a href="#details_methods">Methods</a> | <a href="#details_constructor">Constructor</a>
    </div>
    <hr />
<div class="package">Namespace template</div>
<h1>Class template</h1>
<div id="list">
    <ul>
        <li><strong>template</strong></li></ul></li>    </ul>
</div>
<hr />
<p class="arguments">public  class <strong>template</strong></p>
<div class="comment" id="overview_description">Templates parser.</div>
<div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Program</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">phpapi: PHP Documentation Creator</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Version</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">6.0</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Author</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">Victor Nabatov greenray.spb@gmail.com</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Copyright</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">(c) 2015 - 2016 Victor Nabatov</td>
                    </tr>
            <tr>
            <td class="hid left w_100">License</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">Creative Commons Attribution-ShareAlike 4.0 International</td>
                    </tr>
            <tr>
            <td class="hid left w_100">File</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">/system/classes/template.php</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Overview</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">Completely separated from php code.
 Handles special tags and replaces them with commands of the php interpreter.
 It is able recursively execute functions and directives:
 FOREACH, IF, ELSE, ELSEIF, SWITCH, CASE, BREAK, DEFAULT, INCLUDE, CONTINUE.</td>
                    </tr>
        </table>
</div>
    <h2 id="details_fields">Fields</h2>
            <div class="location">system/classes/template.php at line 21</div>
        <pre class="arguments" id="code">private  string <strong><span class="green">$code</span></strong> = <span class="red">""</span>;</pre>
        <div class="details">Template content</div>
        <hr />
            <div class="location">system/classes/template.php at line 24</div>
        <pre class="arguments" id="file">private  string <strong><span class="green">$file</span></strong> = <span class="red">""</span>;</pre>
        <div class="details">Name of the template file that is currently executing</div>
        <hr />
            <div class="location">system/classes/template.php at line 27</div>
        <pre class="arguments" id="line">private  integer <strong><span class="green">$line</span></strong> = 0;</pre>
        <div class="details">Current line of the template content</div>
        <hr />
            <div class="location">system/classes/template.php at line 30</div>
        <pre class="arguments" id="statements">private  array <strong><span class="green">$statements</span></strong> = [<br />        <span class="red">"BREAK"</span>    =&gt; <span class="red">"&lt;?php break;?&gt;"</span>,<br />        <span class="red">"CONTINUE"</span> =&gt; <span class="red">"&lt;?php continue;?&gt;"</span>,<br />        <span class="red">"DEFAULT"</span>  =&gt; <span class="red">"&lt;?php default: ?&gt;"</span>,<br />        <span class="red">"ELSE"</span>     =&gt; <span class="red">"&lt;?php } else { ?&gt;"</span>,<br />        <span class="red">"END"</span>      =&gt; <span class="red">"&lt;?php } ?&gt;"</span><br />    ];</pre>
        <div class="details">Template statements</div>
        <hr />
            <div class="location">system/classes/template.php at line 32</div>
        <pre class="arguments" id="temp">private  array <strong><span class="green">$temp</span></strong> = [];</pre>
        <div class="details">Temporary variable for code processing</div>
        <hr />
            <div class="location">system/classes/template.php at line 35</div>
        <pre class="arguments" id="translations">private  array <strong><span class="green">$translations</span></strong> = [];</pre>
        <div class="details">Locales</div>
        <hr />
            <div class="location">system/classes/template.php at line 38</div>
        <pre class="arguments" id="vars">private  array <strong><span class="green">$vars</span></strong> = [];</pre>
        <div class="details">Temporary variables</div>
        <hr />
        <h2 id="details_constructor">Constructor</h2>
    <div class="location">system/classes/template.php at line 46</div>
    <code class="arguments" id="construct">public  void <strong>construct</strong>(<span class="lilac">array</span> <span class="blue">$template</span>, <span class="lilac">array</span> <span class="blue">$options</span>)</code>
    <div class="details">
            <p class="description">Class constructor.</p>
        <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">array</td>
                            <td class="hid blue w_100">$template</td>
                <td class="hid">Template file</td>
                    </tr>
            <tr>
            <td class="hid left w_100">&nbsp</td>
            <td class="hid right w_100 lilac">array</td>
                            <td class="hid blue w_100">$options</td>
                <td class="hid">Template parser options</td>
                    </tr>
        </table>
</div>
    </div>
    <h2 id="details_methods">Methods</h2>
            <div class="location">system/classes/template.php at line 54</div>
        <code class="arguments" id="getTemplate">private  void <strong>getTemplate</strong> (<span class="lilac">string</span> <span class="blue">$template</span>, <a href="../phpapi/phpapi.html">phpapi</a> <span class="blue">&$phpapi</span>)</code>
        <div class="details">
                    include LOCALES.$phpapi->options[<span class="red">"language"</span>].<span class="red">".php"</span><br />                    <p class="description">Reads template.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$template</td>
                <td class="hid">Template filename with full path</td>
                    </tr>
            <tr>
            <td class="hid left w_100">&nbsp</td>
            <td class="hid right w_100 lilac"><a href="../phpapi/phpapi.html">phpapi</a></td>
                            <td class="hid blue w_100">&$phpapi</td>
                <td class="hid">Reference to the application object</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 82</div>
        <code class="arguments" id="set">public  void <strong>set</strong> (<span class="lilac">mixed</span> <span class="blue">$var</span>, <span class="lilac">mixed</span> <span class="blue">$value</span>)</code>
        <div class="details">
                    <p class="description">Sets a variables (plain or array) of the template.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">mixed</td>
                            <td class="hid blue w_100">$var</td>
                <td class="hid">Variable name</td>
                    </tr>
            <tr>
            <td class="hid left w_100">&nbsp</td>
            <td class="hid right w_100 lilac">mixed</td>
                            <td class="hid blue w_100">$value</td>
                <td class="hid">Variable value</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 93</div>
        <code class="arguments" id="parse">public  string <strong>parse</strong> (<span class="lilac">mixed</span> <span class="blue">&$phpapi</span>, <span class="lilac">mixed</span> <span class="blue">$template</span>)</code>
        <div class="details">
                    <p class="description">Parses the code (HTML & template) and transform the template code in php code.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Parsed template</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 128</div>
        <code class="arguments" id="parseLine">private  string <strong>parseLine</strong> (<span class="lilac">string</span> <span class="blue">$code</span>)</code>
        <div class="details">
                    <p class="description">Parses a line of code.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$code</td>
                <td class="hid">Line of code</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Code transformed in php code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 193</div>
        <code class="arguments" id="createVar">private  string <strong>createVar</strong> (<span class="lilac">string</span> <span class="blue">$code</span>)</code>
        <div class="details">
                    <p class="description">Creates variable.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$code</td>
                <td class="hid">Template basic code</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 212</div>
        <code class="arguments" id="_foreach">private  string <strong>_foreach</strong> (<span class="lilac">string</span> <span class="blue">$param</span>)</code>
        <div class="details">
                    <p class="description">Trasnforms the FOREACH structure in php code.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$param</td>
                <td class="hid">Parameters for FOREACH structure</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 230</div>
        <code class="arguments" id="_if">private  string <strong>_if</strong> (<span class="lilac">string</span> <span class="blue">$code</span>, <span class="lilac">boolean</span> <span class="blue">$elseif</span>)</code>
        <div class="details">
                    <p class="description">Transforms the IF structure in php code.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$code</td>
                <td class="hid">Code for IF structure</td>
                    </tr>
            <tr>
            <td class="hid left w_100">&nbsp</td>
            <td class="hid right w_100 lilac">boolean</td>
                            <td class="hid blue w_100">$elseif</td>
                <td class="hid">Flag indicating if the structure is IF or ELSEIF</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 246</div>
        <code class="arguments" id="_switch">private  string <strong>_switch</strong> (<span class="lilac">string</span> <span class="blue">$param</span>)</code>
        <div class="details">
                    <p class="description">Transforms the SWITCH structure in php code.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$param</td>
                <td class="hid">Code for the SWITCH structure</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 257</div>
        <code class="arguments" id="_case">private  string <strong>_case</strong> (<span class="lilac">string</span> <span class="blue">$param</span>)</code>
        <div class="details">
                    <p class="description">Transforms the CASE structure in php code.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$param</td>
                <td class="hid">Parameter for CASE structure</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 271</div>
        <code class="arguments" id="translate">private  string <strong>translate</strong> (<span class="lilac">array</span> <span class="blue">$match</span>)</code>
        <div class="details">
                    <p class="description">Localization.<br /> Array variable $matches contains:<br />  - $matches[0] = part of template between control structures including them;<br />  - $matches[1] = part of template between control structures excluding them.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">array</td>
                            <td class="hid blue w_100">$match</td>
                <td class="hid">Matches for translation</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Parsed string</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 284</div>
        <code class="arguments" id="value">private  string <strong>value</strong> (<span class="lilac">array</span> <span class="blue">$match</span>)</code>
        <div class="details">
                    <p class="description">Replaces constants and global variables with their values.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">array</td>
                            <td class="hid blue w_100">$match</td>
                <td class="hid">Matches for constants</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Parsed string</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 296</div>
        <code class="arguments" id="compact">private  string <strong>compact</strong> (<span class="lilac">string</span> <span class="blue">$data</span>)</code>
        <div class="details">
                    <p class="description">Compacts compiled template.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$data</td>
                <td class="hid">Compiled template</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Code without newlines and extra spaces</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">system/classes/template.php at line 317</div>
        <code class="arguments" id="randomString">private  string <strong>randomString</strong> (<span class="lilac">integer</span> <span class="blue">$num_chars</span>)</code>
        <div class="details">
                    <p class="description">Generates random string.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">integer</td>
                            <td class="hid blue w_100">$num_chars</td>
                <td class="hid">The lenght of string to generate</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Generated string</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
        <div class="header">
    <span style="float:right">phpAPI v6.0</span>
            <ul>
                    <li><a href="../overview-summary.html">Overview</a></li>
                    <li><a href="../template/package-summary.html">Namespace</a></li>
                    <li class="active">Class</li>
                    <li><a href="../template/package-tree.html">template\Tree</a></li>
                    <li><a href="../deprecated.html">Deprecated</a></li>
                    <li><a href="../todo.html">Todo</a></li>
                    <li><a href="../index-all.html">Index</a></li>
                </ul>
    </div>
<hr />
<div class="small_links">Frames: <a href="../index.html" target="_top"> On</a> | <a href="" target="_top"> Off</a></div>
<hr />
    <div class="small_links">
        <a href="#details_fields">Fields</a> | <a href="#details_methods">Methods</a> | <a href="#details_constructor">Constructor</a>
    </div>
    </body>
</html>
